<template>
  <div>
    <div>
      <Steps :current="current">
        <Step title="设置超级管理员"></Step>
        <Step title="加载配置"></Step>
        <Step title="初始化用户角色"></Step>
        <Step title="初始化权限"></Step>
        <Step title="初始化其他表"></Step>
      </Steps>
    </div>
    <div></div>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  data() {
    return {
      user: {
        user: "",
        password: ""
      },
      rules: {
        username: [
          {
            required: true,
            message: "用户名不能为空"
          }
        ],
        password: [
          {
            required: true,
            message: "密码不能为空"
          }
        ]
      },
      remoteMessage: "",
      isSavePassword: false
    };
  },
  methods: {
    ...mapActions("account", ["login"]),
    submit() {
      this.$refs.form.validate(res => {
        if (!res) {
          return;
        }
        this.login(this.user)
          .then(() => {
            var redirectPath = this.$route.query.redirect;
            this.$router.push(redirectPath || "/");
          })
          .catch(() => {
            this.remoteMessage = "用户名或密码错误";
          });
      });
    }
  }
};
</script>

<style lang="less" scoped>
.login-wrap {
  display: flex;
  justify-content: center;
  flex-direction: column;
  margin: auto;
  height: 100vh;
  width: 300px;
}
.login {
  border-radius: 5px;
  box-shadow: 0 0 5px #ccc;
  padding: 14px;
}
.login-text {
  text-align: center;
  padding-bottom: 12px;
}
.login-bottom {
  display: flex;
  justify-content: space-between;
}
</style>
